<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">


<h:head>
</h:head>
<h:body>


	<p:layout fullPage="true">

		<p:layoutUnit id="top" position="north" size="15%">
			<p:toolbar>
				<p:toolbarGroup align="left">
					<h3><h:link outcome="home.html" value="TravelDream" /></h3>
				</p:toolbarGroup>
				<p:toolbarGroup align="right">

					<h:form>

						<p:commandButton action="#{logoutBean.logout}" value="Logout" />

					</h:form>
					<p:spacer width="10"></p:spacer>

					<p:spacer width="10"></p:spacer>
				</p:toolbarGroup>
			</p:toolbar>
		</p:layoutUnit>
		<p:layoutUnit id="bottom" position="south" size="50%">
			<h:form>
				<p:commandButton value="Visualize my Packages"
					action="#{searchBean.searchSavedPackageByUser()}" />
				<br />
			</h:form>
			<h:form>
				<p:dataTable var="package" value="#{searchBean.filteredListSP}"
					rendered="#{!searchBean.filteredListSP.isEmpty()}">
					<p:column headerText="ID">
						<h3><h:outputText value="#{package.id}" /></h3>
					</p:column>
					<p:column headerText="Departure Location">
						<h:outputText value="#{package.depLocation}" />
					</p:column>
					<p:column headerText="Arrival Location">
						<h:outputText value="#{package.arrLocation}" />
					</p:column>
					<p:column headerText="Departure Date:">
						<h:outputText value="#{package.depDate}" />
					</p:column>
					<p:column headerText="Return Date:">
						<h:outputText value="#{package.retDate}" />
					</p:column>
					<p:column headerText="Commands" style="width:4%">
						<p:commandButton id="selectButton" 
							icon="ui-icon-search"
							title="View" action="#{savedPackageBean.visualizeMyPackage()}">
							<f:setPropertyActionListener value="#{package}"
								target="#{savedPackageBean.savedPackage}" />
							<f:setPropertyActionListener target="#{searchBean.filteredListSP}" value="#{null}" /> 
								
						</p:commandButton>
						<p:commandButton id="deleteBPButton" 
							icon="ui-icon-trash" rendered="#{!package.confirmed}"
							title="Delete" action="#{searchBean.deleteSavedPackage()}">
							<f:setPropertyActionListener value="#{package}"
								target="#{searchBean.selectedSavedPackage}" />
						</p:commandButton>
					</p:column>

				</p:dataTable>
			</h:form>
		</p:layoutUnit>

		<p:layoutUnit id="left" position="west" size="33%">
                <br/>	Hello dear costumer, welcome back to your TravelDream account!   <br/><br/>
                	
                	<p:commandButton value="Modify Account Details"
						action="#{editBean.searchCurrentUser()}" />
						            
                </p:layoutUnit>

		<p:layoutUnit id="right" position="east" size="33%"> <br/>
			<a href="/TravelDreamWeb/users/search.xhtml">Start creating a package</a> from our base products or from one of our suggestions!
		</p:layoutUnit>

		<p:layoutUnit id="center" position="center">
			<p:layout>
				<p:layoutUnit id="inner_center" position="center" size="0%">
                       <br/> If you already have a package ID given by a friend, insert it here!   <br/><br/> Insert ID:                       	   
                	  <h:form>
						<p:inputText id="ID" value="#{savedPackageBean.packID}" />
						<br />
						<p:commandButton type="submit" value="Submit"
							action="#{savedPackageBean.searchSavedPackagebyID()}" >
							</p:commandButton>
					</h:form>


				</p:layoutUnit>
				
			</p:layout>
		</p:layoutUnit>

	</p:layout>
</h:body>
</html>



